package com.sjsoft.payment;


import com.sjsoft.app.video.R;
import com.sjsoft.application.chatVideoApp;
import com.sjsoft.video.loadPaymentInfor;

import android.os.Bundle;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.app.Activity;
import android.content.Context;


public class PayCard extends Activity {

	private String sTelCode = "";
	protected Context context;
    @Override
    public void onCreate(Bundle savedInstanceState) {
    	super.onCreate(savedInstanceState);
		setContentView(R.layout.pay_money_dlg);//content_layout
		
		Bundle extras = getIntent().getExtras();
		if (extras == null) {
		   
		    }
		// Get data via the key
		sTelCode = extras.getString("Network");
		TextView title = (TextView)findViewById(R.id.text_pay_type);
		if(sTelCode.equalsIgnoreCase("VTE"))
			title.setText("Nạp bằng thẻ Viettel");
		else if(sTelCode.equalsIgnoreCase("VNP"))
			title.setText("Nạp bằng thẻ Vina phone");
		else if(sTelCode.equalsIgnoreCase("VMS"))
			title.setText("Nạp bằng thẻ Mobi phone");
		context = this;
		
		ImageView img_sen_infor = (ImageView)findViewById(R.id.img_pay_coints);
		img_sen_infor.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				chatVideoApp application = (chatVideoApp)getApplicationContext();
		    	String sImei = application.sImei;		    	
		    	
		    	EditText edCodeCard = (EditText)findViewById(R.id.ed_serial);
		    	String sCodeCard = edCodeCard.getText().toString();
		    	EditText edMst = (EditText)findViewById(R.id.ed_mst);
		    	String sMst = edMst.getText().toString();
		    	if(!sCodeCard.equalsIgnoreCase("") && !sMst.equalsIgnoreCase(""))
		    	{
		    		loadPaymentInfor loadPayment = new loadPaymentInfor(context);
			    	loadPayment.setTypePayment("1");// pay by card
			    	loadPayment.setCodeCard(sCodeCard);
			    	loadPayment.setSerial(sMst);
			    	loadPayment.setImei(sImei);
			    	loadPayment.setCodeCenter(sTelCode);
			    	
			    	loadPayment.execute();
			    	finish();
		    	}
		    	{
		    		//Show alert
		    	}
		    	
			}
		});
		
		ImageView img_exit = (ImageView)findViewById(R.id.img_exit);
		img_exit.setOnClickListener(new View.OnClickListener() {
			
			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
				finish();
			}
		});
		
	}
    public void showResult(String message)
    {
    	 
    }
}
